<?php 
// Подключаем оболочку SPIP
require_once('../inc/spip_launcher.php'); ?>

$(document).ready(function() {	
    // Load dynblocks when page first loaded, and set interval of update
	if ($('.radiodj_dynblock_last_songs').length > 0) {
	    $('.radiodj_dynblock_last_songs').load('<?php echo find_in_path("radiodj_dynblocks/last_songs.html"); ?>');
		setInterval(function(){
			$('.radiodj_dynblock_last_songs').load('<?php echo find_in_path("radiodj_dynblocks/last_songs.html"); ?>');
		}, radiodj_config['songs_reload_time']);
	}    
    if ($('.radiodj_djonline').length > 0) {
        $('.radiodj_dynblock_djonline').load('<?php echo find_in_path("radiodj_dynblocks/djonline.html"); ?>');
        setInterval(function(){
		    $('.radiodj_dynblock_djonline').load('<?php echo find_in_path("radiodj_dynblocks/djonline.html"); ?>');
		}, radiodj_config['djs_reload_time']);    
    }
	
	if ($('.radiodj_dynblock_listeners_online').length > 0) {
	    $('.radiodj_dynblock_listeners_online').load('<?php echo find_in_path("radiodj_dynblocks/listeners_online.html"); ?>');
        setInterval(function(){
		    $('.radiodj_dynblock_listeners_online').load('<?php echo find_in_path("radiodj_dynblocks/listeners_online.html"); ?>');
		}, radiodj_config['listeners_online_time']);    
    }
	
	if ($('.radiodj_dynblock_curprogram').length > 0) {
	    $('.radiodj_dynblock_curprogram').load('<?php echo find_in_path("radiodj_dynblocks/curprogram.html"); ?>');
        setInterval(function(){
            $('.radiodj_dynblock_curprogram').load('<?php echo find_in_path("radiodj_dynblocks/curprogram.html"); ?>');
		}, radiodj_config['program_reload_time']);    
    }   
    
    // Online Player
	$('a.radiodj_listen_online').click(function(){
		var params = 'height=160,width=160,left=200,top=200,toolbar=0,location=0,menubar=0,direction=0,scrollbars=0'
		window.open('?page=radiodj_listen',radiodj_config['player_title'],params);
		return false;
	});
});    